<div id="view-content" style="padding-left: 25px;">
    <?php if($this->message) echo "<p class='error'>".$this->message."</p>"; ?><br/>
    <div class="titular" style="text-align: center;">
        <h4 style='text-decoration:underline;'>Llistat de departaments</h4>
    </div>
    <br/>
    <?php
    $total = count($this->llistat);
    if ($total > 0) {
        echo "<table class='table table-striped'>";
        echo "<thead><tr><th>#</th><th>Departament</th><th>Descripci&oacute;</th></tr></thead>";
        for ($i = 0; $i < $total; $i++) {
            echo "<tr>";
            echo ("<td>" . ($i + 1) . "</td><td>" . $this->llistat[$i]['nom'] . "</td>");
            echo ("<td>" . $this->llistat[$i]['descripcio'] . "</td>");
            echo "<td><a href=" . $this->url(array('controller' => 'departament', 'action' => 'editar', 'id' => $this->llistat[$i]['id'])) . " class='btn btn-mini'><i class=\"icon-pencil\"></i>Editar</a></td>";
            echo "<td><a href=" . $this->url(array('controller' => 'departament', 'action' => 'eliminar', 'id' => $this->llistat[$i]['id'])) . " class='btn btn-danger btn-mini'><i class=\"icon-remove\"></i>Eliminar</a></td>";
            echo "</tr>";
        }
        echo "</table>";
    } else {
        echo "<p style='margin-left:20px;'>No hi ha departaments</p>";
    }
    ?>
    <p><a class="btn btn-success" href=<?php echo $this->url(array('controller' => 'departament', 'action' => 'afegir')); ?>><i class="icon-plus"></i>Afegir departament</a></p>
</div>
